package test5

import (
	"errors"
	"fmt"
)

func add(a, b int) (c int, err error) {
	if (a < 0 || b < 0) {
		err = errors.New("只支持非负整数相加")
		return
	}
	a *= 2
	b *= 3
	c = a + b
	return
}

func divide() {
	defer func() {
		if err := recover(); err != nil {
			fmt.Printf("Runtime panci caugth: %v\n", err)
		}
	}()
	var i = 1
	var j = 0
	k := i / j
	fmt.Printf("%d / %d = %d\n", i, j, k)

}

func Test1() {
	divide()
	println("66666")
	//fmt.Println(os.Args)
	//
	//if len(os.Args) != 3 {
	//	fmt.Println("传参个数出现错误")
	//	return
	//}
	//
	//x, _ := strconv.Atoi(os.Args[1])
	//y, _ := strconv.Atoi(os.Args[2])
	//z, err := add(x, y)
	//if err != nil {
	//	fmt.Println(err)
	//} else {
	//	fmt.Printf("add(%d, %d) = %d\n", x, y, z)
	//}

}